home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume23 / flex2.3 / part04 < prev    next >
Encoding:
Internet Message Format  |  1990-10-10  |  52.8 KB

  1. Subject:  v23i040:  Flex, a fast lex replacement, Part04/10
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: a7d25fc5 420511c0 bf5c3f37 a812d241
  5.  
  6. Submitted-by: Vern Paxson <vern@cs.cornell.edu>
  7. Posting-number: Volume 23, Issue 40
  8. Archive-name: flex2.3/part04
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # Contents:  MISC/Atari.patches flex.1
  17. # Wrapped by rsalz@litchi.bbn.com on Wed Oct 10 13:24:00 1990
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. echo If this archive is complete, you will see the following message:
  20. echo '          "shar: End of archive 4 (of 10)."'
  21. if test -f 'MISC/Atari.patches' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'MISC/Atari.patches'\"
  23. else
  24.   echo shar: Extracting \"'MISC/Atari.patches'\" \(29474 characters\)
  25.   sed "s/^X//" >'MISC/Atari.patches' <<'END_OF_FILE'
  26. X(Message inbox:32)
  27. XDate:          Mon, 03 Jul 89 21:15:32 CET
  28. XFrom:  V61%DHDURZ1.BITNET@lbl.gov
  29. XSubject:       Flex, bug fix, improvments, patches for Minix & TOS
  30. XTo:  vern@lbl-csam.arpa
  31. X
  32. XAt first I have to thank you for your wonderful program. I had ported the
  33. Xold version to OS9,TOS (Atari ST) and Minix and the new version 2.1 Beta
  34. Xto Minix and TOS.
  35. X     
  36. XWhile porting and using flex I detected a bug and made some improvements.
  37. XI have included a  shared, compressed and uuencoded file contaning all cdiffs
  38. Xand additional files (Sorry, but I'm on EBCDIC-Bitnet) and a short discussion
  39. Xof the changes. Even some of the TOS specific changes might be of general
  40. Xinterest !
  41. X     
  42. XI posted these cdiffs to the minix discussion group, but I think it's up
  43. Xto you to post them to the unix-sources group. If you plan to post even
  44. Xthe TOS compiler specific patches please contact me because there might be
  45. Xfurther compiler (P.D.) additions. If you have an interest I could also
  46. Xport the new version to OS9 -- this is a little bit more difficult, because
  47. XOS9 uses CR as end of line character (the EOL char. is coded into the
  48. Xinitscan.c tables,...). It is necessary to change all occurences of '\n' to
  49. Xmacros and variables and it's useful to add a new -n options (see commented
  50. Xline in main.c)
  51. X     
  52. X     
  53. X     
  54. XThe changes:                                                  (1.7.89 RAL)
  55. X     
  56. X - Bug fix: The original flex didn't like trailing spaces in exclusive start
  57. X     condition lists ! If you add an trailing space to line 68 in scan.l
  58. X     
  59. X     "%x SECT2 SECT2PROLOG SECT3 CODEBLOCK PICKUPDEF SC CARETISBOL NUM QUOTE "
  60. X     
  61. X     you get a misleading error message:
  62. X     
  63. X     "Syntax error at line 69: bad start condition list"
  64. X     
  65. X     This bug can either be fixed in parse.y or in scan.l . I have chosen the
  66. X     last because there the fix is minimal: Just change the rule (line 128)
  67. X     
  68. X      "\n"    to   "{OPTWS}\n"
  69. X     
  70. X - Enhancements:
  71. X    - new option "-?" that provides some help information about the other
  72. X      flags (main.c)
  73. X    - new option "-aTMPPATH" that allows a redefinition of the standard
  74. X      path for the temporary file (this might be rather large >200k if
  75. X      F,f options are selected). (main.c, flexdef.h (l.376))
  76. X    - hexdump of illegal characters -- this proved to be a useful debugging
  77. X      tool especialy if invisible control characters occur which weren't
  78. X      covered by the rules. (scan.l  fprintf statement line 129,...)
  79. X     
  80. X - Patches due to TOS
  81. X    - General: TOS uses CR,LF as end of line char., Flex wants only a single
  82. X      LF as EOL char. Therefore all I/O must be translated using f* calls.
  83. X      This is done everywhere besides the YY_INPUT macro (flex.skel (scan.c),
  84. X      line 31) that uses a low level 'read'. This should be definitly changed
  85. X      to fread, so that all I/O calls occur on the same level.
  86. X    - the short action_file_name has been "flexXXXXXX.tmp", but that's too
  87. X      much for TOS,MSDOS ! I changed it to "flexXXXX.tmp" in main.c (patch
  88. X      covered by the -a option additions)
  89. X    - some compilers don't like external names that are ambiguous within
  90. X      the first 8 characters. I defined macros that change all these long
  91. X      external names to names that are unique within the first 8 characters.
  92. X      Just define SHORT_EXTERNAL_NAMES to use this feature (flexdef.h)
  93. X    - some statement changes that some compiler don't like:
  94. X      typedef *xxx[]  -> typedef **xxx       (flexdef.h.,l.308)
  95. X      "/*" -> '/','*' within a comment in (scan.l, l.209)
  96. X    - changed short "lexyy.c" to "lex_yy.c" what's more similar to the unix
  97. X      "lex.yy.c" (main.c).
  98. X    - a few further really compiler dependent changes provided with
  99. X      #ifdef ATARI && LATTICE res. TURBO braces.
  100. X     
  101. X - Additional TOS only files
  102. X    - Makefile.tos: Common makefile for all TOS compilers. If you add further
  103. X      ones please email me the new makefile.
  104. X    - flex.lnk: Lattice - GST linker argument extension file
  105. X    - flex.tlk: Turbo linker argument extension file
  106. X     
  107. X     
  108. XAdditional remarks:
  109. X     
  110. XI didn't add a new initscan.c (= flex -ist scan.l). The current one is good
  111. Xenough for a first compilation. With this first version of flex you can
  112. Xrebuild your own scan.c and the final flex version !
  113. X     
  114. XMinix ST :
  115. X  - I had to "chmem =70000 cv" (>50000) to get flex linked
  116. X  - 'memset' (PC 1.3, EFTH40,...) is necessary
  117. X  - chmem =90000 flex may be sufficient
  118. X     
  119. XMinix PC :
  120. X  It should be possible to port Flex to Minix PC. The current sizes of flex
  121. X  are:
  122. X                        Minix ST (ACK)    Lattice (TOS)    Turbo (TOS)
  123. X     
  124. X       size               75300             83305             57957
  125. X       compilation time      22'               15'             3'40"
  126. X       flex -is scan.l     1'49"               43"               30"
  127. X     
  128. X  The Minix ST size includes the bad generated code using only a subset of
  129. X  the 68000 commands, long addresses only and a huge relocation table.
  130. X  Therefore the PC size will be <64 k ! More serious is the fact that I had
  131. X  to chmem =90000 flex to get scan.l converted to scan.c . But I never saw
  132. X  a more complex lex source than scan.l -- so it should be possible to
  133. X  reduce some array sizes without limitation for all day usage.
  134. X     
  135. X  No one volunteered yet for a Minix PC port -- but if someone will try it
  136. X  I would provide him with a new scan.c and some hints.
  137. X     
  138. XTOS:
  139. X  Don't forget to adapt the flexskel path within flexdef.h !
  140. X     
  141. X     
  142. XBitnet:  V61@DHDURZ1                               Ronald Lamprecht
  143. XUUCP:    ...!unido!DHDURZ1.bitnet!V61              Theoretische Physik
  144. XARPAnet: V61%DHDURZ1.BITNET@CUNYVM.CUNY.EDU       (Heidelberg, West Germany)
  145. X(Message inbox:36)
  146. XDate:          Wed, 05 Jul 89 21:16:07 CET
  147. XFrom:  V61%DHDURZ1.BITNET@csa2.lbl.gov
  148. XSubject:       Re: What is TOS
  149. XTo:  vern@lbl-csam.arpa
  150. X
  151. XTOS is the name of the Atari ST operating system that is very similar
  152. Xto MSDOS (Both use CR,LF as end of line character). Therefore I have
  153. Xbeen astonished that no EOL convertion porblems occur within MSDOS.
  154. X     
  155. XI have been aware of the double buffering when changing read to fread and  I
  156. Xaccept your argument of a possible slow down. But if you integrate the other
  157. XAtari - TOS changes, please insert a
  158. X        #ifdef ATARI
  159. X              fread ....
  160. X        #else
  161. X              read  ....
  162. X        #endif
  163. Xin flex.skel .
  164. X     
  165. XBitnet:  V61@DHDURZ1                               Ronald Lamprecht
  166. XUUCP:    ...!unido!DHDURZ1.bitnet!V61              Theoretische Physik
  167. XARPAnet: V61%DHDURZ1.BITNET@CUNYVM.CUNY.EDU       (Heidelberg, West Germany)
  168. X
  169. X
  170. X
  171. X
  172. Xecho x - Makefile_cdiff
  173. Xsed '/^X/s///' > Makefile_cdiff << '/'
  174. XX*** Src_2.1/Makefile    Thu Jun 28 00:06:42 1989
  175. XX--- Makefile    Thu Jul  3 02:12:48 1989
  176. XX***************
  177. XX*** 5,10 ****
  178. XX--- 5,11 ----
  179. XX  # Porting considerations:
  180. XX  #
  181. XX  #    For System V Unix machines, add -DSYS_V to CFLAGS.
  182. XX+ #    For Minix (ST), add -DSYS_V to CFLAGS
  183. XX  #    For Vax/VMS, add -DSYS_V to CFLAGS.
  184. XX  #    For MS-DOS, add "-DMS_DOS -DSYS_V" to CFLAGS.  Create \tmp if not present.
  185. XX  #         You will also want to rename flex.skel to something with a three
  186. XX***************
  187. XX*** 21,28 ****
  188. XX  SKELETON_DIR = /usr/local/lib
  189. XX  SKELETON_FILE = flex.skel
  190. XX  SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_DIR)/$(SKELETON_FILE)\"
  191. XX! CFLAGS = -O
  192. XX! LDFLAGS = -s
  193. XX  
  194. XX  FLEX_FLAGS =
  195. XX  FLEX = ./flex
  196. XX--- 22,29 ----
  197. XX  SKELETON_DIR = /usr/local/lib
  198. XX  SKELETON_FILE = flex.skel
  199. XX  SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_DIR)/$(SKELETON_FILE)\"
  200. XX! CFLAGS = -O -DSYS_V
  201. XX! LDFLAGS = 
  202. XX  
  203. XX  FLEX_FLAGS =
  204. XX  FLEX = ./flex
  205. XX***************
  206. XX*** 57,63 ****
  207. XX      yylex.c
  208. XX  
  209. XX  flex : $(FLEXOBJS)
  210. XX!     $(CC) $(CFLAGS) -o flex $(LDFLAGS) $(FLEXOBJS)
  211. XX  
  212. XX  first_flex:
  213. XX      cp initscan.c scan.c
  214. XX--- 58,65 ----
  215. XX      yylex.c
  216. XX  
  217. XX  flex : $(FLEXOBJS)
  218. XX!     $(CC) $(CFLAGS) -o flex $(FLEXOBJS) $(LDFLAGS)
  219. XX!     chmem =150000 flex
  220. XX  
  221. XX  first_flex:
  222. XX      cp initscan.c scan.c
  223. X/
  224. Xecho x - flex.skel_cdif
  225. Xsed '/^X/s///' > flex.skel_cdif << '/'
  226. XX*** Src_2.1/flex.skel    Thu Jun 28 00:19:20 1989
  227. XX--- flex.skel    Thu Jul  2 22:18:31 1989
  228. XX***************
  229. XX*** 28,34 ****
  230. XX   * is returned in "result".
  231. XX   */
  232. XX  #define YY_INPUT(buf,result,max_size) \
  233. XX!     if ( (result = read( fileno(yyin), buf, max_size )) < 0 ) \
  234. XX          YY_FATAL_ERROR( "read() in flex scanner failed" );
  235. XX  #define YY_NULL 0
  236. XX  #define yyterminate() return ( YY_NULL )
  237. XX--- 28,34 ----
  238. XX   * is returned in "result".
  239. XX   */
  240. XX  #define YY_INPUT(buf,result,max_size) \
  241. XX!     if ( (result = fread( buf,1, max_size, yyin )) < 0 ) \
  242. XX          YY_FATAL_ERROR( "read() in flex scanner failed" );
  243. XX  #define YY_NULL 0
  244. XX  #define yyterminate() return ( YY_NULL )
  245. X/
  246. Xecho x - flexdef.h_cdif
  247. Xsed '/^X/s///' > flexdef.h_cdif << '/'
  248. XX*** Src_2.1/flexdef.h    Thu Jun 28 00:43:27 1989
  249. XX--- flexdef.h    Thu Jul  3 02:45:50 1989
  250. XX***************
  251. XX*** 26,31 ****
  252. XX--- 26,40 ----
  253. XX  
  254. XX  /* @(#) $Header: flexdef.h,v 2.0 89/06/20 15:49:50 vern Locked $ (LBL) */
  255. XX  
  256. XX+ #ifdef ATARI
  257. XX+ #define SYS_V
  258. XX+ #define abs(x) ((x) < 0 ? -(x) : (x))
  259. XX+ #define SHORT_FILE_NAMES
  260. XX+ #ifdef TURBO
  261. XX+ #define SHORT_EXTERNAL_NAMES
  262. XX+ #endif
  263. XX+ #endif
  264. XX+ 
  265. XX  #ifndef FILE
  266. XX  #include <stdio.h>
  267. XX  #endif
  268. XX***************
  269. XX*** 41,47 ****
  270. XX  #endif
  271. XX  
  272. XX  #ifndef VMS
  273. XX! char *memset();
  274. XX  #else
  275. XX  /* memset is needed for old versions of the VMS C runtime library */
  276. XX  #define memset(s, c, n) \
  277. XX--- 50,58 ----
  278. XX  #endif
  279. XX  
  280. XX  #ifndef VMS
  281. XX! #ifndef ATARI && TURBO
  282. XX! char *memset();
  283. XX! #endif
  284. XX  #else
  285. XX  /* memset is needed for old versions of the VMS C runtime library */
  286. XX  #define memset(s, c, n) \
  287. XX***************
  288. XX*** 81,91 ****
  289. XX--- 92,129 ----
  290. XX  #define true 1
  291. XX  #define false 0
  292. XX  
  293. XX+ #ifdef ATARI
  294. XX+ #define DEFAULT_SKELETON_FILE "D:\\include\\flexskel"
  295. XX+ #endif
  296. XX+ 
  297. XX  
  298. XX  #ifndef DEFAULT_SKELETON_FILE
  299. XX  #define DEFAULT_SKELETON_FILE "flex.skel"
  300. XX  #endif
  301. XX  
  302. XX+ #ifdef SHORT_EXTERNAL_NAMES
  303. XX+ /* avoid long external names that are ambiguous within the first 8 characters */
  304. XX+ #define current_mns                 c__mns
  305. XX+ #define current_max_rules           c__max_rules
  306. XX+ #define current_max_state_type      c__max_state_type
  307. XX+ #define current_max_scs             c__max_scs
  308. XX+ #define current_max_dfa_size        c__max__size
  309. XX+ #define current_max_xpairs          c__max_xpairs
  310. XX+ #define current_max_template_xpairs c__max_template_xpairs
  311. XX+ #define current_max_dfas            c__max_dfas
  312. XX+ #define current_maxccls             c__maxccles
  313. XX+ #define current_max_ccl_tbl_size    c__max_ccl_tbl_size
  314. XX+ #define indent_puts                 ind_puts
  315. XX+ #define indent_put2s                ind_put2s
  316. XX+ #define gen_next_compressed_state   gen_n_comressed_state
  317. XX+ #define gen_next_match              gen_n_match
  318. XX+ #define gen_next_state              gen_n_state
  319. XX+ #define variable_trailing_context_rules  var_tr_context_rules
  320. XX+ #define variable_trailing_rule           var_tr_rule
  321. XX+ #define backtrack_report            backtr_report
  322. XX+ #define backtrack_file              backtr_file
  323. XX+ #endif
  324. XX+ 
  325. XX  /* special chk[] values marking the slots taking by end-of-buffer and action
  326. XX   * numbers
  327. XX   */
  328. XX***************
  329. XX*** 305,311 ****
  330. XX      int int_val;
  331. XX      } ;
  332. XX  
  333. XX! typedef struct hash_entry *hash_table[];
  334. XX  
  335. XX  #define NAME_TABLE_HASH_SIZE 101
  336. XX  #define START_COND_HASH_SIZE 101
  337. XX--- 343,349 ----
  338. XX      int int_val;
  339. XX      } ;
  340. XX  
  341. XX! typedef struct hash_entry **hash_table;
  342. XX  
  343. XX  #define NAME_TABLE_HASH_SIZE 101
  344. XX  #define START_COND_HASH_SIZE 101
  345. XX***************
  346. XX*** 372,378 ****
  347. XX  extern int datapos, dataline, linenum;
  348. XX  extern FILE *skelfile, *yyin, *temp_action_file, *backtrack_file;
  349. XX  extern char *infilename;
  350. XX! extern char action_file_name[];
  351. XX  
  352. XX  
  353. XX  /* variables for stack of states having only one out-transition:
  354. XX--- 410,416 ----
  355. XX  extern int datapos, dataline, linenum;
  356. XX  extern FILE *skelfile, *yyin, *temp_action_file, *backtrack_file;
  357. XX  extern char *infilename;
  358. XX! extern char *action_file_name;
  359. XX  
  360. XX  
  361. XX  /* variables for stack of states having only one out-transition:
  362. X/
  363. Xecho x - main.c_cdiff
  364. Xsed '/^X/s///' > main.c_cdiff << '/'
  365. XX*** Src_2.1/main.c    Thu Jun 28 00:30:39 1989
  366. XX--- main.c    Thu Jul  3 02:27:47 1989
  367. XX***************
  368. XX*** 81,96 ****
  369. XX  FILE *temp_action_file;
  370. XX  FILE *backtrack_file;
  371. XX  int end_of_buffer_state;
  372. XX! #ifndef SHORT_FILE_NAMES
  373. XX! char action_file_name[] = "/tmp/flexXXXXXX";
  374. XX! #else
  375. XX! char action_file_name[] = "flexXXXXXX.tmp";
  376. XX! #endif
  377. XX! 
  378. XX  #ifndef SHORT_FILE_NAMES
  379. XX  static char outfile[] = "lex.yy.c";
  380. XX  #else
  381. XX! static char outfile[] = "lexyy.c";
  382. XX  #endif
  383. XX  static int outfile_created = 0;
  384. XX  
  385. XX--- 81,91 ----
  386. XX  FILE *temp_action_file;
  387. XX  FILE *backtrack_file;
  388. XX  int end_of_buffer_state;
  389. XX! char *action_file_name;
  390. XX  #ifndef SHORT_FILE_NAMES
  391. XX  static char outfile[] = "lex.yy.c";
  392. XX  #else
  393. XX! static char outfile[] = "lex_yy.c";
  394. XX  #endif
  395. XX  static int outfile_created = 0;
  396. XX  
  397. XX***************
  398. XX*** 328,333 ****
  399. XX--- 323,329 ----
  400. XX      {
  401. XX      int i, sawcmpflag, use_stdout;
  402. XX      char *arg, *skelname = NULL, *flex_gettime(), clower(), *mktemp();
  403. XX+     char *tmp_action =(char *)0, *malloc();
  404. XX  
  405. XX      printstats = syntaxerror = trace = spprdflt = interactive = caseins = false;
  406. XX      backtrack_report = performance_report = ddebug = fulltbl = fullspd = false;
  407. XX***************
  408. XX*** 349,354 ****
  409. XX--- 345,355 ----
  410. XX      for ( i = 1; arg[i] != '\0'; ++i )
  411. XX          switch ( arg[i] )
  412. XX          {
  413. XX+         case 'a':
  414. XX+             if ( i != 1 )
  415. XX+             flexerror( "-a flag must be given separately" );
  416. XX+             tmp_action = &arg[i+1];
  417. XX+             goto get_next_arg;
  418. XX          case 'b':
  419. XX              backtrack_report = true;
  420. XX              break;
  421. XX***************
  422. XX*** 445,452 ****
  423. XX              printstats = true;
  424. XX              break;
  425. XX  
  426. XX!         default:
  427. XX!             lerrif( "unknown flag %c", (int) arg[i] );
  428. XX              break;
  429. XX          }
  430. XX  
  431. XX--- 446,458 ----
  432. XX              printstats = true;
  433. XX              break;
  434. XX  
  435. XX!         case '?':
  436. XX!             flexinfo(0);
  437. XX!             break;
  438. XX! 
  439. XX!         default:
  440. XX!             fprintf(stderr,"flex : unknown flag %c\n", (int) arg[i] );
  441. XX!             flexinfo(1);
  442. XX              break;
  443. XX          }
  444. XX  
  445. XX***************
  446. XX*** 454,459 ****
  447. XX--- 460,493 ----
  448. XX      ;
  449. XX      }
  450. XX  
  451. XX+ 
  452. XX+ /* if you change the default tmp file names don't forget to change the
  453. XX+    initialization for i, too !
  454. XX+    
  455. XX+ */
  456. XX+ #ifndef SHORT_FILE_NAMES
  457. XX+     i = 10;
  458. XX+     if (!tmp_action) i += 5;
  459. XX+ #else
  460. XX+     i = 12;
  461. XX+ #endif
  462. XX+     if (tmp_action) 
  463. XX+         i += strlen(tmp_action) + 1;
  464. XX+     if((action_file_name = malloc(i+1)) == (char *)0)
  465. XX+         flexerror("No memory for action_file_name");
  466. XX+     *action_file_name = (char) NULL;
  467. XX+     if (tmp_action) 
  468. XX+         strcat(action_file_name,tmp_action);
  469. XX+ #ifndef SHORT_FILE_NAMES
  470. XX+     else
  471. XX+         strcat(action_file_name,"/tmp");
  472. XX+     strcat(action_file_name,"/flexXXXXXX");
  473. XX+ #else
  474. XX+     if (tmp_action)
  475. XX+         strcat(action_file_name,"/");
  476. XX+     strcat(action_file_name,"flexXXXX.tmp");
  477. XX+ #endif
  478. XX+     
  479. XX      if ( (fulltbl || fullspd) && usemecs )
  480. XX      flexerror( "full table and -cm don't make sense together" );
  481. XX  
  482. XX***************
  483. XX*** 520,526 ****
  484. XX      if ( (skelfile = fopen( skelname, "r" )) == NULL )
  485. XX      lerrsf( "can't open skeleton file %s", skelname );
  486. XX  
  487. XX!     (void) mktemp( action_file_name );
  488. XX  
  489. XX      if ( (temp_action_file = fopen( action_file_name, "w" )) == NULL )
  490. XX      lerrsf( "can't open temporary action file %s", action_file_name );
  491. XX--- 554,562 ----
  492. XX      if ( (skelfile = fopen( skelname, "r" )) == NULL )
  493. XX      lerrsf( "can't open skeleton file %s", skelname );
  494. XX  
  495. XX! #ifndef ATARI && LATTICE
  496. XX!     (void) mktemp( action_file_name );
  497. XX! #endif
  498. XX  
  499. XX      if ( (temp_action_file = fopen( action_file_name, "w" )) == NULL )
  500. XX      lerrsf( "can't open temporary action file %s", action_file_name );
  501. XX***************
  502. XX*** 566,571 ****
  503. XX--- 602,640 ----
  504. XX      }
  505. XX  
  506. XX  
  507. XX+ flexinfo(status)
  508. XX+ int status;
  509. XX+ {
  510. XX+    fprintf(stderr,"Syntax  :  FLEX  inp_file\n");
  511. XX+    fprintf(stderr,"Function: fast lexical analyzer generator  V%s\n",flex_version);
  512. XX+    fprintf(stderr,"Options : a dir_path  : directory path for temporary files\n");
  513. XX+    fprintf(stderr,"    - b  : generate backtracking information to lex.backtrack\n");
  514. XX+    fprintf(stderr,"    - c  : compressed table, no equiv., no meta equiv.classes\n");
  515. XX+    fprintf(stderr,"       e : equivalence classes\n");
  516. XX+    fprintf(stderr,"       F : fast table\n");
  517. XX+    fprintf(stderr,"      |f : full table\n");
  518. XX+    fprintf(stderr,"      |m : meta equivalence classes\n");
  519. XX+    fprintf(stderr,"    - d  : generate debugging scanner\n");
  520. XX+    fprintf(stderr,"    - F  : fast table\n");
  521. XX+    fprintf(stderr,"    - f  : full (not compressed) table\n");
  522. XX+    fprintf(stderr,"    - I  : generate interactive scanner\n");
  523. XX+    fprintf(stderr,"    - i  : generate case-insensitive scanner\n");
  524. XX+    fprintf(stderr,"    - L  : supress #line directives\n");
  525. XX+ /*   fprintf(stderr,"    - n hexnum : generate scanner using <hexnum> as newline char.\n");*/
  526. XX+    fprintf(stderr,"    - p  : generate performance report to stderr\n");
  527. XX+    fprintf(stderr,"    - S skeleton_path : file path for skeleton file\n");
  528. XX+    fprintf(stderr,"    - s  : suppress echo of unmatched scanner input to stdout\n");
  529. XX+    fprintf(stderr,"    - T  : run flex in trace mode\n");
  530. XX+ #ifdef ATARI
  531. XX+    fprintf(stderr,"    - t  : place result on stdout instead of lex_yy.c\n");
  532. XX+ #else
  533. XX+    fprintf(stderr,"    - t  : place result on stdout instead of lex.yy.c\n");
  534. XX+ #endif
  535. XX+    fprintf(stderr,"    - v  : print statistics of generated scanner\n");
  536. XX+    fprintf(stderr,"     default =  -cem\n");
  537. XX+    exit(status);
  538. XX+ }
  539. XX+ 
  540. XX  /* readin - read in the rules section of the input file(s)
  541. XX   *
  542. XX   * synopsis
  543. X/
  544. Xecho x - scan.l_cdiff
  545. Xsed '/^X/s///' > scan.l_cdiff << '/'
  546. XX*** Src_2.1/scan.l    Thu Jun 30 19:42:00 1989
  547. XX--- scan.l    Thu Jul  2 22:19:26 1989
  548. XX***************
  549. XX*** 125,132 ****
  550. XX  
  551. XX  {SCNAME}        RETURNNAME;
  552. XX  ^{OPTWS}\n        ++linenum; /* allows blank lines in section 1 */
  553. XX! \n            ++linenum; return ( '\n' );
  554. XX! .            synerr( "illegal character" ); BEGIN(RECOVER);
  555. XX  
  556. XX  
  557. XX  <C_COMMENT>"*/"        ECHO; BEGIN(0);
  558. XX--- 125,136 ----
  559. XX  
  560. XX  {SCNAME}        RETURNNAME;
  561. XX  ^{OPTWS}\n        ++linenum; /* allows blank lines in section 1 */
  562. XX! {OPTWS}\n        ++linenum; return ( '\n' );
  563. XX! .            {
  564. XX!             synerr( "illegal character" );
  565. XX!             fprintf(stderr,"Char : $%x\n",yytext[yyleng-1]);
  566. XX!             BEGIN(RECOVER);
  567. XX!             }
  568. XX  
  569. XX  
  570. XX  <C_COMMENT>"*/"        ECHO; BEGIN(0);
  571. XX***************
  572. XX*** 206,212 ****
  573. XX  <SECT2>^{OPTWS}\n    ++linenum; /* allow blank lines in section 2 */
  574. XX  
  575. XX      /* this horrible mess of a rule matches indented lines which
  576. XX!      * do not contain "/*".  We need to make the distinction because
  577. XX       * otherwise this rule will be taken instead of the rule which
  578. XX       * matches the beginning of comments like this one
  579. XX       */
  580. XX--- 210,216 ----
  581. XX  <SECT2>^{OPTWS}\n    ++linenum; /* allow blank lines in section 2 */
  582. XX  
  583. XX      /* this horrible mess of a rule matches indented lines which
  584. XX!      * do not contain '/','*'.  We need to make the distinction because
  585. XX       * otherwise this rule will be taken instead of the rule which
  586. XX       * matches the beginning of comments like this one
  587. XX       */
  588. X/
  589. Xecho x - Makefile.tos
  590. Xsed '/^X/s///' > Makefile.tos << '/'
  591. XX# make file for "flex" tool
  592. XX
  593. XX# @(#) $Header: Makefile,v 2.3 89/06/20 17:27:12 vern Exp $ (LBL)
  594. XX
  595. XX# Porting considerations:
  596. XX#
  597. XX#    For System V Unix machines, add -DSYS_V to CFLAGS.
  598. XX#    For Vax/VMS, add -DSYS_V to CFLAGS.
  599. XX#    For MS-DOS, add "-DMS_DOS -DSYS_V" to CFLAGS.  Create \tmp if not present.
  600. XX#         You will also want to rename flex.skel to something with a three
  601. XX#         character extension, change SKELETON_FILE below appropriately,
  602. XX#    For Amiga, add "-DAMIGA -DSYS_V" to CFLAGS.
  603. XX#
  604. XX# A long time ago, flex was successfully built using Microsoft C and
  605. XX# the following options: /AL, /stack:10000, -LARGE, -Ml, -Mt128, -DSYS_V
  606. XX
  607. XX
  608. XX# the first time around use "make first_flex"
  609. XX
  610. XX# The following definitions must be set according to your compiler -
  611. XX# examples for a Lattice Compiler with GST assembler and TURBO C with
  612. XX# assembler are provided below and must just be updated (don't forget to
  613. XX# update the linker argument extension files (*.lnk,*.tlk), too) :
  614. XX#
  615. XX#CCPATH  = path to compiler directory without trailing \
  616. XX#CHPATH  = path to header files without trailing \
  617. XX#CC      = filename of the compiler
  618. XX#CFLAGS  = compiler option flags
  619. XX#CIEXT   = extension of C sources that should be used for input filenames
  620. XX#ASMPATH = path to assembler directory without trailing \
  621. XX#ASM     = filename of the assembler
  622. XX#AFLAGS  = assembler option flags
  623. XX#AIEXT   = extension of assembler sources that should be used for assembler
  624. XX#          input filenames
  625. XX#AEXT    = general assembler filename extension
  626. XX#LNKPATH = path to linker directory without trailing \
  627. XX#LINK    = filename of the linker
  628. XX#LFLAG0  = first option (full pathname of C startupcode) 
  629. XX#LFLAG1  = further options + option flag for argument extension filename
  630. XX#LFLAG2  = further options + option flag for output-filename 
  631. XX#LNKEXT  = extension of linker argument extension file
  632. XX#OIEXT   = extension of objects that should be used for linker input files
  633. XX#OEXT    = general object file extension
  634. XX
  635. XX# Lattice definitions
  636. XXCCPATH  = d:\latt
  637. XXCHPATH  = d:\latt\include
  638. XXCC      = lc.ttp
  639. XXCFLAGS  = -h -n -cw -cc -i$(CHPATH)\ -g$(CCPATH)\ -dLATTICE -dATARI
  640. XXCIEXT   =
  641. XXASMPATH = d:\gst
  642. XXASM     = assem.ttp
  643. XXAFLAGS  = -nolist -errors errors.out
  644. XXAIEXT   =
  645. XXAEXT    = .asm
  646. XXLNKPATH = d:\gst
  647. XXLINK    = ld.ttp
  648. XXLFLAG0  =
  649. XXLFLAG1  = -with 
  650. XXLFLAG2  = -nolist -sec -mem 200 -prog 
  651. XXLNKEXT  = .lnk
  652. XXOIEXT   =
  653. XXOEXT    = .bin
  654. XX
  655. XX# Turbo definitions
  656. XX#CCPATH  = d:\turbo
  657. XX#CHPATH  = d:\turbo\include
  658. XX#CC      = tcc.prg
  659. XX#CFLAGS  = -GJMPRZ -H=$(CHPATH)\ -w- -DTURBO -DATARI
  660. XX#CIEXT   = .c
  661. XX#ASMPATH = d:\turbo
  662. XX#ASM     = mas.prg
  663. XX#AFLAGS  =
  664. XX#AIEXT   = .s
  665. XX#AEXT    = .s
  666. XX#LNKPATH = d:\turbo
  667. XX#LINK    = tlink.ttp
  668. XX#LFLAG0  = $(LNKPATH)\lib\tcstart.o
  669. XX#LFLAG1  = -I=
  670. XX#LFLAG2  = -O=
  671. XX#LNKEXT  = .tlk
  672. XX#OIEXT   = .o
  673. XX#OEXT    = .o
  674. XX
  675. XX# Other definitions
  676. XX# (not used for Atari because of short argument string - defined in flexdef.h
  677. XX
  678. XXSKELETON_DIR = /usr/lib
  679. XXSKELETON_FILE = flex.skel
  680. XXSKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_DIR)/$(SKELETON_FILE)\"
  681. XX
  682. XX
  683. XXFLEX       = d:\etc\flex.ttp
  684. XXFLEX_FLAGS = -is
  685. XXYACC       = d:\etc\yacc.ttp
  686. XXRENAME     = d:\bin\rename
  687. XXDEL        = d:\bin\del
  688. XX
  689. XX# Internal definitions
  690. XXLNK     = $(LNKPATH)\$(LINK)
  691. XX
  692. XXFLEXOBJS = \
  693. XX    ccl$(OEXT) \
  694. XX    dfa$(OEXT) \
  695. XX    ecs$(OEXT) \
  696. XX    gen$(OEXT) \
  697. XX    main$(OEXT) \
  698. XX    misc$(OEXT) \
  699. XX    nfa$(OEXT) \
  700. XX    parse$(OEXT) \
  701. XX    scan$(OEXT) \
  702. XX    sym$(OEXT) \
  703. XX    tblcmp$(OEXT) \
  704. XX    yylex$(OEXT)
  705. XX
  706. XXFLEX_C_SOURCES = \
  707. XX    ccl.c \
  708. XX    dfa.c \
  709. XX    ecs.c \
  710. XX    gen.c \
  711. XX    main.c \
  712. XX    misc.c \
  713. XX    nfa.c \
  714. XX    parse.c \
  715. XX    scan.c \
  716. XX    sym.c \
  717. XX    tblcmp.c \
  718. XX    yylex.c
  719. XX
  720. XXflex : $(FLEXOBJS)
  721. XX     $(LNK) $(LFLAG0) $(LFLAG1)flex$(LNKEXT) $(LFLAG2)flex.ttp
  722. XX
  723. XXfirst_flex:
  724. XX    cp initscan.c scan.c
  725. XX    make $(MFLAGS) flex
  726. XX
  727. XXparse.h parse.c : parse.y
  728. XX    $(YACC)   -d parse.y
  729. XX    $(DEL)    parse.c
  730. XX    $(RENAME) y_tab.c parse.c
  731. XX    $(DEL)    parse.h
  732. XX    $(RENAME) y_tab.h parse.h
  733. XX
  734. XXscan.c : scan.l
  735. XX    $(FLEX)   $(FLEX_FLAGS) scan.l
  736. XX    $(RENAME) lex_yy.c scan.c
  737. XX
  738. XXscan$(OEXT) : scan.c parse.h flexdef.h
  739. XX     $(CCPATH)\$(CC) $(CFLAGS) scan$(CIEXT)
  740. XX
  741. XXmain$(OEXT) : main.c flexdef.h
  742. XX     $(CCPATH)\$(CC) $(CFLAGS)  main$(CIEXT)
  743. XX
  744. XXccl$(OEXT) : ccl.c flexdef.h 
  745. XX     $(CCPATH)\$(CC) $(CFLAGS)  ccl$(CIEXT)
  746. XX
  747. XXdfa$(OEXT) : dfa.c flexdef.h
  748. XX     $(CCPATH)\$(CC) $(CFLAGS)  dfa$(CIEXT)
  749. XX
  750. XXecs$(OEXT) : ecs.c flexdef.h
  751. XX     $(CCPATH)\$(CC) $(CFLAGS)  ecs$(CIEXT)
  752. XX
  753. XXgen$(OEXT) : gen.c flexdef.h
  754. XX     $(CCPATH)\$(CC) $(CFLAGS)  gen$(CIEXT)
  755. XX
  756. XXmisc$(OEXT) : misc.c flexdef.h
  757. XX     $(CCPATH)\$(CC) $(CFLAGS)  misc$(CIEXT)
  758. XX
  759. XXnfa$(OEXT) : nfa.c flexdef.h
  760. XX     $(CCPATH)\$(CC) $(CFLAGS)  nfa$(CIEXT)
  761. XX
  762. XXparse$(OEXT) : parse.c flexdef.h
  763. XX     $(CCPATH)\$(CC) $(CFLAGS)  parse$(CIEXT)
  764. XX
  765. XXsym$(OEXT) : sym.c flexdef.h
  766. XX     $(CCPATH)\$(CC) $(CFLAGS)  sym$(CIEXT)
  767. XX
  768. XXtblcmp$(OEXT) : tblcmp.c flexdef.h
  769. XX     $(CCPATH)\$(CC) $(CFLAGS)  tblcmp$(CIEXT)
  770. XX
  771. XXyylex$(OEXT) : yylex.c flexdef.h 
  772. XX     $(CCPATH)\$(CC) $(CFLAGS)  yylex$(CIEXT)
  773. XX
  774. XXflex.man : flex.1
  775. XX    nroff -man flex.1 >flex.man
  776. XX
  777. XXlint : $(FLEX_C_SOURCES)
  778. XX    lint $(FLEX_C_SOURCES) > flex.lint
  779. XX
  780. XXdistrib :
  781. XX    mv scan.c initscan.c
  782. XX    chmod 444 initscan.c
  783. XX    $(MAKE) $(MFLAGS) clean
  784. XX
  785. XXclean :
  786. XX    rm -f core errs flex *$(OEXT) parse.c *.lint parse.h flex.man tags
  787. XX
  788. XXtags :
  789. XX    ctags $(FLEX_C_SOURCES)
  790. XX
  791. XXvms :    flex.man
  792. XX    $(MAKE) $(MFLAGS) distrib
  793. XX
  794. XXtest :
  795. XX    $(FLEX) $(FLEX_FLAGS) scan.l
  796. XX    $(RENAME) lex_yy.c scan.ctest
  797. XX    cmp scan.c scan.ctest
  798. XX
  799. X/
  800. Xecho x - Readme2
  801. Xsed '/^X/s///' > Readme2 << '/'
  802. XXThe changes:                                                  (1.7.89 RAL)
  803. XX
  804. XX - Bug fix: The original flex didn't like trailing spaces in exclusive start
  805. XX     condition lists ! If you add an trailing space to line 68 in scan.l
  806. XX     
  807. XX     "%x SECT2 SECT2PROLOG SECT3 CODEBLOCK PICKUPDEF SC CARETISBOL NUM QUOTE "
  808. XX     
  809. XX     you get a misleading error message: 
  810. XX     
  811. XX     "Syntax error at line 69: bad start condition list"
  812. XX     
  813. XX     This bug can either be fixed in parse.y or in scan.l . I have chosen the
  814. XX     last because there the fix is minimal: Just change the rule (line 128)
  815. XX     
  816. XX      "\n"    to   "{OPTWS}\n"
  817. XX      
  818. XX - Enhancements:
  819. XX    - new option "-?" that provides some help information about the other
  820. XX      flags (main.c)
  821. XX    - new option "-aTMPPATH" that allows a redefinition of the standard
  822. XX      path for the temporary file (this might be rather large >200k if 
  823. XX      F,f options are selected). (main.c, flexdef.h (l.376))
  824. XX    - hexdump of illegal characters -- this proved to be a useful debugging
  825. XX      tool especialy if invisible control characters occur which weren't
  826. XX      covered by the rules. (scan.l  fprintf statement line 129,...)
  827. XX      
  828. XX - Patches due to TOS
  829. XX    - General: TOS uses CR,LF as end of line char., Flex wants only a single
  830. XX      LF as EOL char. Therefore all I/O must be translated using f* calls.
  831. XX      This is done everywhere besides the YY_INPUT macro (flex.skel (scan.c),
  832. XX      line 31) that uses a low level 'read'. This should be definitly changed
  833. XX      to fread, so that all I/O calls occur on the same level.
  834. XX    - the short action_file_name has been "flexXXXXXX.tmp", but that's too 
  835. XX      much for TOS,MSDOS ! I changed it to "flexXXXX.tmp" in main.c (patch
  836. XX      covered by the -a option additions)
  837. XX    - some compilers don't like external names that are ambiguous within
  838. XX      the first 8 characters. I defined macros that change all these long
  839. XX      external names to names that are unique within the first 8 characters.
  840. XX      Just define SHORT_EXTERNAL_NAMES to use this feature (flexdef.h)
  841. XX    - some statement changes that some compiler don't like:
  842. XX      typedef *xxx[]  -> typedef **xxx       (flexdef.h.,l.308)
  843. XX      "/*" -> '/','*' within a comment in (scan.l, l.209)
  844. XX    - changed short "lexyy.c" to "lex_yy.c" what's more similar to the unix
  845. XX      "lex.yy.c" (main.c).
  846. XX    - a few further really compiler dependent changes provided with
  847. XX      #ifdef ATARI && LATTICE res. TURBO braces.
  848. XX      
  849. XX - Additional TOS only files
  850. XX    - Makefile.tos: Common makefile for all TOS compilers. If you add further
  851. XX      ones please email me the new makefile.
  852. XX    - flex.lnk: Lattice - GST linker argument extension file
  853. XX    - flex.tlk: Turbo linker argument extension file
  854. XX      
  855. XX    
  856. XXAdditional remarks:
  857. XX 
  858. XXI didn't add a new initscan.c (= flex -ist scan.l). The current one is good
  859. XXenough for a first compilation. With this first version of flex you can
  860. XXrebuild your own scan.c and the final flex version !
  861. XX
  862. XXMinix ST :
  863. XX  - I had to "chmem =70000 cv" (>50000) to get flex linked
  864. XX  - 'memset' (PC 1.3, EFTH40,...) is necessary
  865. XX  - chmem =90000 flex may be sufficient
  866. XX  
  867. XXMinix PC :
  868. XX  It should be possible to port Flex to Minix PC. The current sizes of flex
  869. XX  are:
  870. XX                        Minix ST (ACK)    Lattice (TOS)    Turbo (TOS)
  871. XX       
  872. XX       size               75300             83305             57957
  873. XX       compilation time      22'               15'             3'40"
  874. XX       flex -is scan.l     1'49"               43"               30"
  875. XX       
  876. XX  The Minix ST size includes the bad generated code using only a subset of
  877. XX  the 68000 commands, long addresses only and a huge relocation table.
  878. XX  Therefore the PC size will be <64 k ! More serious is the fact that I had
  879. XX  to chmem =90000 flex to get scan.l converted to scan.c . But I never saw
  880. XX  a more complex lex source than scan.l -- so it should be possible to
  881. XX  reduce some array sizes without limitation for all day usage.
  882. XX  
  883. XX  No one volunteered yet for a Minix PC port -- but if someone will try it
  884. XX  I would provide him with a new scan.c and some hints.
  885. XX  
  886. XXTOS: 
  887. XX  Don't forget to adapt the flexskel path within flexdef.h !
  888. XX
  889. XX
  890. X/
  891. Xecho x - flex.lnk
  892. Xsed '/^X/s///' > flex.lnk << '/'
  893. XX*
  894. XX*
  895. XX*  linker control file for flex.ttp
  896. XX*
  897. XX*
  898. XX*
  899. XXINPUT   d:\latt\lib\startup.bin
  900. XX*
  901. XXINPUT ccl.bin
  902. XXINPUT dfa.bin
  903. XXINPUT ecs.bin
  904. XXINPUT gen.bin
  905. XXINPUT misc.bin
  906. XXINPUT nfa.bin
  907. XXINPUT parse.bin
  908. XXINPUT sym.bin
  909. XXINPUT tblcmp.bin
  910. XXINPUT main.bin
  911. XXINPUT yylex.bin
  912. XXINPUT scan.bin
  913. XX*
  914. XXLIBRARY d:\latt\lib\clib.bin
  915. XX
  916. X/
  917. Xecho x - flex.tlk
  918. Xsed '/^X/s///' > flex.tlk << '/'
  919. XXccl.o
  920. XXdfa.o
  921. XXecs.o
  922. XXgen.o
  923. XXmisc.o
  924. XXnfa.o
  925. XXparse.o
  926. XXsym.o
  927. XXtblcmp.o
  928. XXyylex.o
  929. XXmain.o
  930. XXscan.o
  931. XXd:\turbo\lib\tcstdlib.lib   ; standard lib
  932. XXd:\turbo\lib\tcextlib.lib   ; extended lib
  933. XXd:\turbo\lib\tctoslib.lib   ; TOS lib
  934. XXd:\turbo\lib\tcgemlib.lib   ; AES and VDI lib
  935. XX-S=200000
  936. X/
  937. END_OF_FILE
  938.   if test 29474 -ne `wc -c <'MISC/Atari.patches'`; then
  939.     echo shar: \"'MISC/Atari.patches'\" unpacked with wrong size!
  940.   fi
  941.   # end of 'MISC/Atari.patches'
  942. fi
  943. if test -f 'flex.1' -a "${1}" != "-c" ; then 
  944.   echo shar: Will not clobber existing file \"'flex.1'\"
  945. else
  946.   echo shar: Extracting \"'flex.1'\" \(20799 characters\)
  947.   sed "s/^X//" >'flex.1' <<'END_OF_FILE'
  948. X.TH FLEX 1 "26 May 1990" "Version 2.3"
  949. X.SH NAME
  950. Xflex - fast lexical analyzer generator
  951. X.SH SYNOPSIS
  952. X.B flex
  953. X.B [-bcdfinpstvFILT8 -C[efmF] -Sskeleton]
  954. X.I [filename ...]
  955. X.SH DESCRIPTION
  956. X.I flex
  957. Xis a tool for generating
  958. X.I scanners:
  959. Xprograms which recognized lexical patterns in text.
  960. X.I flex
  961. Xreads
  962. Xthe given input files, or its standard input if no file names are given,
  963. Xfor a description of a scanner to generate.  The description is in
  964. Xthe form of pairs
  965. Xof regular expressions and C code, called
  966. X.I rules.  flex
  967. Xgenerates as output a C source file,
  968. X.B lex.yy.c,
  969. Xwhich defines a routine
  970. X.B yylex().
  971. XThis file is compiled and linked with the
  972. X.B -lfl
  973. Xlibrary to produce an executable.  When the executable is run,
  974. Xit analyzes its input for occurrences
  975. Xof the regular expressions.  Whenever it finds one, it executes
  976. Xthe corresponding C code.
  977. X.LP
  978. XFor full documentation, see
  979. X.B flexdoc(1).
  980. XThis manual entry is intended for use as a quick reference.
  981. X.SH OPTIONS
  982. X.I flex
  983. Xhas the following options:
  984. X.TP
  985. X.B -b
  986. XGenerate backtracking information to
  987. X.I lex.backtrack.
  988. XThis is a list of scanner states which require backtracking
  989. Xand the input characters on which they do so.  By adding rules one
  990. Xcan remove backtracking states.  If all backtracking states
  991. Xare eliminated and
  992. X.B -f
  993. Xor
  994. X.B -F
  995. Xis used, the generated scanner will run faster.
  996. X.TP
  997. X.B -c
  998. Xis a do-nothing, deprecated option included for POSIX compliance.
  999. X.IP
  1000. X.B NOTE:
  1001. Xin previous releases of
  1002. X.I flex
  1003. X.B -c
  1004. Xspecified table-compression options.  This functionality is
  1005. Xnow given by the
  1006. X.B -C
  1007. Xflag.  To ease the the impact of this change, when
  1008. X.I flex
  1009. Xencounters
  1010. X.B -c,
  1011. Xit currently issues a warning message and assumes that
  1012. X.B -C
  1013. Xwas desired instead.  In the future this "promotion" of
  1014. X.B -c
  1015. Xto
  1016. X.B -C
  1017. Xwill go away in the name of full POSIX compliance (unless
  1018. Xthe POSIX meaning is removed first).
  1019. X.TP
  1020. X.B -d
  1021. Xmakes the generated scanner run in
  1022. X.I debug
  1023. Xmode.  Whenever a pattern is recognized and the global
  1024. X.B yy_flex_debug
  1025. Xis non-zero (which is the default), the scanner will
  1026. Xwrite to
  1027. X.I stderr
  1028. Xa line of the form:
  1029. X.nf
  1030. X
  1031. X    --accepting rule at line 53 ("the matched text")
  1032. X
  1033. X.fi
  1034. XThe line number refers to the location of the rule in the file
  1035. Xdefining the scanner (i.e., the file that was fed to flex).  Messages
  1036. Xare also generated when the scanner backtracks, accepts the
  1037. Xdefault rule, reaches the end of its input buffer (or encounters
  1038. Xa NUL; the two look the same as far as the scanner's concerned),
  1039. Xor reaches an end-of-file.
  1040. X.TP
  1041. X.B -f
  1042. Xspecifies (take your pick)
  1043. X.I full table
  1044. Xor
  1045. X.I fast scanner.
  1046. XNo table compression is done.  The result is large but fast.
  1047. XThis option is equivalent to
  1048. X.B -Cf
  1049. X(see below).
  1050. X.TP
  1051. X.B -i
  1052. Xinstructs
  1053. X.I flex
  1054. Xto generate a
  1055. X.I case-insensitive
  1056. Xscanner.  The case of letters given in the
  1057. X.I flex
  1058. Xinput patterns will
  1059. Xbe ignored, and tokens in the input will be matched regardless of case.  The
  1060. Xmatched text given in
  1061. X.I yytext
  1062. Xwill have the preserved case (i.e., it will not be folded).
  1063. X.TP
  1064. X.B -n
  1065. Xis another do-nothing, deprecated option included only for
  1066. XPOSIX compliance.
  1067. X.TP
  1068. X.B -p
  1069. Xgenerates a performance report to stderr.  The report
  1070. Xconsists of comments regarding features of the
  1071. X.I flex
  1072. Xinput file which will cause a loss of performance in the resulting scanner.
  1073. X.TP
  1074. X.B -s
  1075. Xcauses the
  1076. X.I default rule
  1077. X(that unmatched scanner input is echoed to
  1078. X.I stdout)
  1079. Xto be suppressed.  If the scanner encounters input that does not
  1080. Xmatch any of its rules, it aborts with an error.
  1081. X.TP
  1082. X.B -t
  1083. Xinstructs
  1084. X.I flex
  1085. Xto write the scanner it generates to standard output instead
  1086. Xof
  1087. X.B lex.yy.c.
  1088. X.TP
  1089. X.B -v
  1090. Xspecifies that
  1091. X.I flex
  1092. Xshould write to
  1093. X.I stderr
  1094. Xa summary of statistics regarding the scanner it generates.
  1095. X.TP
  1096. X.B -F
  1097. Xspecifies that the
  1098. X.ul
  1099. Xfast
  1100. Xscanner table representation should be used.  This representation is
  1101. Xabout as fast as the full table representation
  1102. X.ul
  1103. X(-f),
  1104. Xand for some sets of patterns will be considerably smaller (and for
  1105. Xothers, larger).  See
  1106. X.B flexdoc(1)
  1107. Xfor details.
  1108. X.IP
  1109. XThis option is equivalent to
  1110. X.B -CF
  1111. X(see below).
  1112. X.TP
  1113. X.B -I
  1114. Xinstructs
  1115. X.I flex
  1116. Xto generate an
  1117. X.I interactive
  1118. Xscanner, that is, a scanner which stops immediately rather than
  1119. Xlooking ahead if it knows
  1120. Xthat the currently scanned text cannot be part of a longer rule's match.
  1121. XAgain, see
  1122. X.B flexdoc(1)
  1123. Xfor details.
  1124. X.IP
  1125. XNote,
  1126. X.B -I
  1127. Xcannot be used in conjunction with
  1128. X.I full
  1129. Xor
  1130. X.I fast tables,
  1131. Xi.e., the
  1132. X.B -f, -F, -Cf,
  1133. Xor
  1134. X.B -CF
  1135. Xflags.
  1136. X.TP
  1137. X.B -L
  1138. Xinstructs
  1139. X.I flex
  1140. Xnot to generate
  1141. X.B #line
  1142. Xdirectives in
  1143. X.B lex.yy.c.
  1144. XThe default is to generate such directives so error
  1145. Xmessages in the actions will be correctly
  1146. Xlocated with respect to the original
  1147. X.I flex
  1148. Xinput file, and not to
  1149. Xthe fairly meaningless line numbers of
  1150. X.B lex.yy.c.
  1151. X.TP
  1152. X.B -T
  1153. Xmakes
  1154. X.I flex
  1155. Xrun in
  1156. X.I trace
  1157. Xmode.  It will generate a lot of messages to
  1158. X.I stdout
  1159. Xconcerning
  1160. Xthe form of the input and the resultant non-deterministic and deterministic
  1161. Xfinite automata.  This option is mostly for use in maintaining
  1162. X.I flex.
  1163. X.TP
  1164. X.B -8
  1165. Xinstructs
  1166. X.I flex
  1167. Xto generate an 8-bit scanner.
  1168. XOn some sites, this is the default.  On others, the default
  1169. Xis 7-bit characters.  To see which is the case, check the verbose
  1170. X.B (-v)
  1171. Xoutput for "equivalence classes created".  If the denominator of
  1172. Xthe number shown is 128, then by default
  1173. X.I flex
  1174. Xis generating 7-bit characters.  If it is 256, then the default is
  1175. X8-bit characters.
  1176. X.TP 
  1177. X.B -C[efmF]
  1178. Xcontrols the degree of table compression.
  1179. X.IP
  1180. X.B -Ce
  1181. Xdirects
  1182. X.I flex
  1183. Xto construct
  1184. X.I equivalence classes,
  1185. Xi.e., sets of characters
  1186. Xwhich have identical lexical properties.
  1187. XEquivalence classes usually give
  1188. Xdramatic reductions in the final table/object file sizes (typically
  1189. Xa factor of 2-5) and are pretty cheap performance-wise (one array
  1190. Xlook-up per character scanned).
  1191. X.IP
  1192. X.B -Cf
  1193. Xspecifies that the
  1194. X.I full
  1195. Xscanner tables should be generated -
  1196. X.I flex
  1197. Xshould not compress the
  1198. Xtables by taking advantages of similar transition functions for
  1199. Xdifferent states.
  1200. X.IP
  1201. X.B -CF
  1202. Xspecifies that the alternate fast scanner representation (described in
  1203. X.B flexdoc(1))
  1204. Xshould be used.
  1205. X.IP
  1206. X.B -Cm
  1207. Xdirects
  1208. X.I flex
  1209. Xto construct
  1210. X.I meta-equivalence classes,
  1211. Xwhich are sets of equivalence classes (or characters, if equivalence
  1212. Xclasses are not being used) that are commonly used together.  Meta-equivalence
  1213. Xclasses are often a big win when using compressed tables, but they
  1214. Xhave a moderate performance impact (one or two "if" tests and one
  1215. Xarray look-up per character scanned).
  1216. X.IP
  1217. XA lone
  1218. X.B -C
  1219. Xspecifies that the scanner tables should be compressed but neither
  1220. Xequivalence classes nor meta-equivalence classes should be used.
  1221. X.IP
  1222. XThe options
  1223. X.B -Cf
  1224. Xor
  1225. X.B -CF
  1226. Xand
  1227. X.B -Cm
  1228. Xdo not make sense together - there is no opportunity for meta-equivalence
  1229. Xclasses if the table is not being compressed.  Otherwise the options
  1230. Xmay be freely mixed.
  1231. X.IP
  1232. XThe default setting is
  1233. X.B -Cem,
  1234. Xwhich specifies that
  1235. X.I flex
  1236. Xshould generate equivalence classes
  1237. Xand meta-equivalence classes.  This setting provides the highest
  1238. Xdegree of table compression.  You can trade off
  1239. Xfaster-executing scanners at the cost of larger tables with
  1240. Xthe following generally being true:
  1241. X.nf
  1242. X
  1243. X    slowest & smallest
  1244. X          -Cem
  1245. X          -Cm
  1246. X          -Ce
  1247. X          -C
  1248. X          -C{f,F}e
  1249. X          -C{f,F}
  1250. X    fastest & largest
  1251. X
  1252. X.fi
  1253. X.IP
  1254. X.B -C
  1255. Xoptions are not cumulative; whenever the flag is encountered, the
  1256. Xprevious -C settings are forgotten.
  1257. X.TP
  1258. X.B -Sskeleton_file
  1259. Xoverrides the default skeleton file from which
  1260. X.I flex
  1261. Xconstructs its scanners.  You'll never need this option unless you are doing
  1262. X.I flex
  1263. Xmaintenance or development.
  1264. X.SH SUMMARY OF FLEX REGULAR EXPRESSIONS
  1265. XThe patterns in the input are written using an extended set of regular
  1266. Xexpressions.  These are:
  1267. X.nf
  1268. X
  1269. X    x          match the character 'x'
  1270. X    .          any character except newline
  1271. X    [xyz]      a "character class"; in this case, the pattern
  1272. X                 matches either an 'x', a 'y', or a 'z'
  1273. X    [abj-oZ]   a "character class" with a range in it; matches
  1274. X                 an 'a', a 'b', any letter from 'j' through 'o',
  1275. X                 or a 'Z'
  1276. X    [^A-Z]     a "negated character class", i.e., any character
  1277. X                 but those in the class.  In this case, any
  1278. X                 character EXCEPT an uppercase letter.
  1279. X    [^A-Z\\n]   any character EXCEPT an uppercase letter or
  1280. X                 a newline
  1281. X    r*         zero or more r's, where r is any regular expression
  1282. X    r+         one or more r's
  1283. X    r?         zero or one r's (that is, "an optional r")
  1284. X    r{2,5}     anywhere from two to five r's
  1285. X    r{2,}      two or more r's
  1286. X    r{4}       exactly 4 r's
  1287. X    {name}     the expansion of the "name" definition
  1288. X               (see above)
  1289. X    "[xyz]\\"foo"
  1290. X               the literal string: [xyz]"foo
  1291. X    \\X         if X is an 'a', 'b', 'f', 'n', 'r', 't', or 'v',
  1292. X                 then the ANSI-C interpretation of \\x.
  1293. X                 Otherwise, a literal 'X' (used to escape
  1294. X                 operators such as '*')
  1295. X    \\123       the character with octal value 123
  1296. X    \\x2a       the character with hexadecimal value 2a
  1297. X    (r)        match an r; parentheses are used to override
  1298. X                 precedence (see below)
  1299. X
  1300. X
  1301. X    rs         the regular expression r followed by the
  1302. X                 regular expression s; called "concatenation"
  1303. X
  1304. X
  1305. X    r|s        either an r or an s
  1306. X
  1307. X
  1308. X    r/s        an r but only if it is followed by an s.  The
  1309. X                 s is not part of the matched text.  This type
  1310. X                 of pattern is called as "trailing context".
  1311. X    ^r         an r, but only at the beginning of a line
  1312. X    r$         an r, but only at the end of a line.  Equivalent
  1313. X                 to "r/\\n".
  1314. X
  1315. X
  1316. X    <s>r       an r, but only in start condition s (see
  1317. X               below for discussion of start conditions)
  1318. X    <s1,s2,s3>r
  1319. X               same, but in any of start conditions s1,
  1320. X               s2, or s3
  1321. X
  1322. X
  1323. X    <<EOF>>    an end-of-file
  1324. X    <s1,s2><<EOF>>
  1325. X               an end-of-file when in start condition s1 or s2
  1326. X
  1327. X.fi
  1328. XThe regular expressions listed above are grouped according to
  1329. Xprecedence, from highest precedence at the top to lowest at the bottom.
  1330. XThose grouped together have equal precedence.
  1331. X.LP
  1332. XSome notes on patterns:
  1333. X.IP -
  1334. XNegated character classes
  1335. X.I match newlines
  1336. Xunless "\\n" (or an equivalent escape sequence) is one of the
  1337. Xcharacters explicitly present in the negated character class
  1338. X(e.g., "[^A-Z\\n]").
  1339. X.IP -
  1340. XA rule can have at most one instance of trailing context (the '/' operator
  1341. Xor the '$' operator).  The start condition, '^', and "<<EOF>>" patterns
  1342. Xcan only occur at the beginning of a pattern, and, as well as with '/' and '$',
  1343. Xcannot be grouped inside parentheses.  The following are all illegal:
  1344. X.nf
  1345. X
  1346. X    foo/bar$
  1347. X    foo|(bar$)
  1348. X    foo|^bar
  1349. X    <sc1>foo<sc2>bar
  1350. X
  1351. X.fi
  1352. X.SH SUMMARY OF SPECIAL ACTIONS
  1353. XIn addition to arbitrary C code, the following can appear in actions:
  1354. X.IP -
  1355. X.B ECHO
  1356. Xcopies yytext to the scanner's output.
  1357. X.IP -
  1358. X.B BEGIN
  1359. Xfollowed by the name of a start condition places the scanner in the
  1360. Xcorresponding start condition.
  1361. X.IP -
  1362. X.B REJECT
  1363. Xdirects the scanner to proceed on to the "second best" rule which matched the
  1364. Xinput (or a prefix of the input).
  1365. X.B yytext
  1366. Xand
  1367. X.B yyleng
  1368. Xare set up appropriately.  Note that
  1369. X.B REJECT
  1370. Xis a particularly expensive feature in terms scanner performance;
  1371. Xif it is used in
  1372. X.I any
  1373. Xof the scanner's actions it will slow down
  1374. X.I all
  1375. Xof the scanner's matching.  Furthermore,
  1376. X.B REJECT
  1377. Xcannot be used with the
  1378. X.I -f
  1379. Xor
  1380. X.I -F
  1381. Xoptions.
  1382. X.IP
  1383. XNote also that unlike the other special actions,
  1384. X.B REJECT
  1385. Xis a
  1386. X.I branch;
  1387. Xcode immediately following it in the action will
  1388. X.I not
  1389. Xbe executed.
  1390. X.IP -
  1391. X.B yymore()
  1392. Xtells the scanner that the next time it matches a rule, the corresponding
  1393. Xtoken should be
  1394. X.I appended
  1395. Xonto the current value of
  1396. X.B yytext
  1397. Xrather than replacing it.
  1398. X.IP -
  1399. X.B yyless(n)
  1400. Xreturns all but the first
  1401. X.I n
  1402. Xcharacters of the current token back to the input stream, where they
  1403. Xwill be rescanned when the scanner looks for the next match.
  1404. X.B yytext
  1405. Xand
  1406. X.B yyleng
  1407. Xare adjusted appropriately (e.g.,
  1408. X.B yyleng
  1409. Xwill now be equal to
  1410. X.I n
  1411. X).
  1412. X.IP -
  1413. X.B unput(c)
  1414. Xputs the character
  1415. X.I c
  1416. Xback onto the input stream.  It will be the next character scanned.
  1417. X.IP -
  1418. X.B input()
  1419. Xreads the next character from the input stream (this routine is called
  1420. X.B yyinput()
  1421. Xif the scanner is compiled using
  1422. X.B C++).
  1423. X.IP -
  1424. X.B yyterminate()
  1425. Xcan be used in lieu of a return statement in an action.  It terminates
  1426. Xthe scanner and returns a 0 to the scanner's caller, indicating "all done".
  1427. X.IP
  1428. XBy default,
  1429. X.B yyterminate()
  1430. Xis also called when an end-of-file is encountered.  It is a macro and
  1431. Xmay be redefined.
  1432. X.IP -
  1433. X.B YY_NEW_FILE
  1434. Xis an action available only in <<EOF>> rules.  It means "Okay, I've
  1435. Xset up a new input file, continue scanning".
  1436. X.IP -
  1437. X.B yy_create_buffer( file, size )
  1438. Xtakes a
  1439. X.I FILE
  1440. Xpointer and an integer
  1441. X.I size.
  1442. XIt returns a YY_BUFFER_STATE
  1443. Xhandle to a new input buffer large enough to accomodate
  1444. X.I size
  1445. Xcharacters and associated with the given file.  When in doubt, use
  1446. X.B YY_BUF_SIZE
  1447. Xfor the size.
  1448. X.IP -
  1449. X.B yy_switch_to_buffer( new_buffer )
  1450. Xswitches the scanner's processing to scan for tokens from
  1451. Xthe given buffer, which must be a YY_BUFFER_STATE.
  1452. X.IP -
  1453. X.B yy_delete_buffer( buffer )
  1454. Xdeletes the given buffer.
  1455. X.SH VALUES AVAILABLE TO THE USER
  1456. X.IP -
  1457. X.B char *yytext
  1458. Xholds the text of the current token.  It may not be modified.
  1459. X.IP -
  1460. X.B int yyleng
  1461. Xholds the length of the current token.  It may not be modified.
  1462. X.IP -
  1463. X.B FILE *yyin
  1464. Xis the file which by default
  1465. X.I flex
  1466. Xreads from.  It may be redefined but doing so only makes sense before
  1467. Xscanning begins.  Changing it in the middle of scanning will have
  1468. Xunexpected results since
  1469. X.I flex
  1470. Xbuffers its input.  Once scanning terminates because an end-of-file
  1471. Xhas been seen,
  1472. X.B
  1473. Xvoid yyrestart( FILE *new_file )
  1474. Xmay be called to point
  1475. X.I yyin
  1476. Xat the new input file.
  1477. X.IP -
  1478. X.B FILE *yyout
  1479. Xis the file to which
  1480. X.B ECHO
  1481. Xactions are done.  It can be reassigned by the user.
  1482. X.IP -
  1483. X.B YY_CURRENT_BUFFER
  1484. Xreturns a
  1485. X.B YY_BUFFER_STATE
  1486. Xhandle to the current buffer.
  1487. X.SH MACROS THE USER CAN REDEFINE
  1488. X.IP -
  1489. X.B YY_DECL
  1490. Xcontrols how the scanning routine is declared.
  1491. XBy default, it is "int yylex()", or, if prototypes are being
  1492. Xused, "int yylex(void)".  This definition may be changed by redefining
  1493. Xthe "YY_DECL" macro.  Note that
  1494. Xif you give arguments to the scanning routine using a
  1495. XK&R-style/non-prototyped function declaration, you must terminate
  1496. Xthe definition with a semi-colon (;).
  1497. X.IP -
  1498. XThe nature of how the scanner
  1499. Xgets its input can be controlled by redefining the
  1500. X.B YY_INPUT
  1501. Xmacro.
  1502. XYY_INPUT's calling sequence is "YY_INPUT(buf,result,max_size)".  Its
  1503. Xaction is to place up to
  1504. X.I max_size
  1505. Xcharacters in the character array
  1506. X.I buf
  1507. Xand return in the integer variable
  1508. X.I result
  1509. Xeither the
  1510. Xnumber of characters read or the constant YY_NULL (0 on Unix systems)
  1511. Xto indicate EOF.  The default YY_INPUT reads from the
  1512. Xglobal file-pointer "yyin".
  1513. XA sample redefinition of YY_INPUT (in the definitions
  1514. Xsection of the input file):
  1515. X.nf
  1516. X
  1517. X    %{
  1518. X    #undef YY_INPUT
  1519. X    #define YY_INPUT(buf,result,max_size) \\
  1520. X        { \\
  1521. X        int c = getchar(); \\
  1522. X        result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \\
  1523. X        }
  1524. X    %}
  1525. X
  1526. X.fi
  1527. X.IP -
  1528. XWhen the scanner receives an end-of-file indication from YY_INPUT,
  1529. Xit then checks the
  1530. X.B yywrap()
  1531. Xfunction.  If
  1532. X.B yywrap()
  1533. Xreturns false (zero), then it is assumed that the
  1534. Xfunction has gone ahead and set up
  1535. X.I yyin
  1536. Xto point to another input file, and scanning continues.  If it returns
  1537. Xtrue (non-zero), then the scanner terminates, returning 0 to its
  1538. Xcaller.
  1539. X.IP
  1540. XThe default
  1541. X.B yywrap()
  1542. Xalways returns 1.  Presently, to redefine it you must first
  1543. X"#undef yywrap", as it is currently implemented as a macro.  It is
  1544. Xlikely that
  1545. X.B yywrap()
  1546. Xwill soon be defined to be a function rather than a macro.
  1547. X.IP -
  1548. XYY_USER_ACTION
  1549. Xcan be redefined to provide an action
  1550. Xwhich is always executed prior to the matched rule's action.
  1551. X.IP -
  1552. XThe macro
  1553. X.B YY_USER_INIT
  1554. Xmay be redefined to provide an action which is always executed before
  1555. Xthe first scan.
  1556. X.IP -
  1557. XIn the generated scanner, the actions are all gathered in one large
  1558. Xswitch statement and separated using
  1559. X.B YY_BREAK,
  1560. Xwhich may be redefined.  By default, it is simply a "break", to separate
  1561. Xeach rule's action from the following rule's.
  1562. X.SH FILES
  1563. X.TP
  1564. X.I flex.skel
  1565. Xskeleton scanner.
  1566. X.TP
  1567. X.I lex.yy.c
  1568. Xgenerated scanner (called
  1569. X.I lexyy.c
  1570. Xon some systems).
  1571. X.TP
  1572. X.I lex.backtrack
  1573. Xbacktracking information for
  1574. X.B -b
  1575. Xflag (called
  1576. X.I lex.bck
  1577. Xon some systems).
  1578. X.TP
  1579. X.B -lfl
  1580. Xlibrary with which to link the scanners.
  1581. X.SH "SEE ALSO"
  1582. X.LP
  1583. Xflexdoc(1), lex(1), yacc(1), sed(1), awk(1).
  1584. X.LP
  1585. XM. E. Lesk and E. Schmidt,
  1586. X.I LEX - Lexical Analyzer Generator
  1587. X.SH DIAGNOSTICS
  1588. X.I reject_used_but_not_detected undefined
  1589. Xor
  1590. X.LP
  1591. X.I yymore_used_but_not_detected undefined -
  1592. XThese errors can occur at compile time.  They indicate that the
  1593. Xscanner uses
  1594. X.B REJECT
  1595. Xor
  1596. X.B yymore()
  1597. Xbut that
  1598. X.I flex
  1599. Xfailed to notice the fact, meaning that
  1600. X.I flex
  1601. Xscanned the first two sections looking for occurrences of these actions
  1602. Xand failed to find any, but somehow you snuck some in (via a #include
  1603. Xfile, for example).  Make an explicit reference to the action in your
  1604. X.I flex
  1605. Xinput file.  (Note that previously
  1606. X.I flex
  1607. Xsupported a
  1608. X.B %used/%unused
  1609. Xmechanism for dealing with this problem; this feature is still supported
  1610. Xbut now deprecated, and will go away soon unless the author hears from
  1611. Xpeople who can argue compellingly that they need it.)
  1612. X.LP
  1613. X.I flex scanner jammed -
  1614. Xa scanner compiled with
  1615. X.B -s
  1616. Xhas encountered an input string which wasn't matched by
  1617. Xany of its rules.
  1618. X.LP
  1619. X.I flex input buffer overflowed -
  1620. Xa scanner rule matched a string long enough to overflow the
  1621. Xscanner's internal input buffer (16K bytes - controlled by
  1622. X.B YY_BUF_MAX
  1623. Xin "flex.skel").
  1624. X.LP
  1625. X.I scanner requires -8 flag -
  1626. XYour scanner specification includes recognizing 8-bit characters and
  1627. Xyou did not specify the -8 flag (and your site has not installed flex
  1628. Xwith -8 as the default).
  1629. X.LP
  1630. X.I
  1631. Xfatal flex scanner internal error--end of buffer missed -
  1632. XThis can occur in an scanner which is reentered after a long-jump
  1633. Xhas jumped out (or over) the scanner's activation frame.  Before
  1634. Xreentering the scanner, use:
  1635. X.nf
  1636. X
  1637. X    yyrestart( yyin );
  1638. X
  1639. X.fi
  1640. X.LP
  1641. X.I too many %t classes! -
  1642. XYou managed to put every single character into its own %t class.
  1643. X.I flex
  1644. Xrequires that at least one of the classes share characters.
  1645. X.SH AUTHOR
  1646. XVern Paxson, with the help of many ideas and much inspiration from
  1647. XVan Jacobson.  Original version by Jef Poskanzer.
  1648. X.LP
  1649. XSee flexdoc(1) for additional credits and the address to send comments to.
  1650. X.SH DEFICIENCIES / BUGS
  1651. X.LP
  1652. XSome trailing context
  1653. Xpatterns cannot be properly matched and generate
  1654. Xwarning messages ("Dangerous trailing context").  These are
  1655. Xpatterns where the ending of the
  1656. Xfirst part of the rule matches the beginning of the second
  1657. Xpart, such as "zx*/xy*", where the 'x*' matches the 'x' at
  1658. Xthe beginning of the trailing context.  (Note that the POSIX draft
  1659. Xstates that the text matched by such patterns is undefined.)
  1660. X.LP
  1661. XFor some trailing context rules, parts which are actually fixed-length are
  1662. Xnot recognized as such, leading to the abovementioned performance loss.
  1663. XIn particular, parts using '|' or {n} (such as "foo{3}") are always
  1664. Xconsidered variable-length.
  1665. X.LP
  1666. XCombining trailing context with the special '|' action can result in
  1667. X.I fixed
  1668. Xtrailing context being turned into the more expensive
  1669. X.I variable
  1670. Xtrailing context.  For example, this happens in the following example:
  1671. X.nf
  1672. X
  1673. X    %%
  1674. X    abc      |
  1675. X    xyz/def
  1676. X
  1677. X.fi
  1678. X.LP
  1679. XUse of unput() invalidates yytext and yyleng.
  1680. X.LP
  1681. XUse of unput() to push back more text than was matched can
  1682. Xresult in the pushed-back text matching a beginning-of-line ('^')
  1683. Xrule even though it didn't come at the beginning of the line
  1684. X(though this is rare!).
  1685. X.LP
  1686. XPattern-matching of NUL's is substantially slower than matching other
  1687. Xcharacters.
  1688. X.LP
  1689. X.I flex
  1690. Xdoes not generate correct #line directives for code internal
  1691. Xto the scanner; thus, bugs in
  1692. X.I flex.skel
  1693. Xyield bogus line numbers.
  1694. X.LP
  1695. XDue to both buffering of input and read-ahead, you cannot intermix
  1696. Xcalls to <stdio.h> routines, such as, for example,
  1697. X.B getchar(),
  1698. Xwith
  1699. X.I flex
  1700. Xrules and expect it to work.  Call
  1701. X.B input()
  1702. Xinstead.
  1703. X.LP
  1704. XThe total table entries listed by the
  1705. X.B -v
  1706. Xflag excludes the number of table entries needed to determine
  1707. Xwhat rule has been matched.  The number of entries is equal
  1708. Xto the number of DFA states if the scanner does not use
  1709. X.B REJECT,
  1710. Xand somewhat greater than the number of states if it does.
  1711. X.LP
  1712. X.B REJECT
  1713. Xcannot be used with the
  1714. X.I -f
  1715. Xor
  1716. X.I -F
  1717. Xoptions.
  1718. X.LP
  1719. XSome of the macros, such as
  1720. X.B yywrap(),
  1721. Xmay in the future become functions which live in the
  1722. X.B -lfl
  1723. Xlibrary.  This will doubtless break a lot of code, but may be
  1724. Xrequired for POSIX-compliance.
  1725. X.LP
  1726. XThe
  1727. X.I flex
  1728. Xinternal algorithms need documentation.
  1729. END_OF_FILE
  1730.   if test 20799 -ne `wc -c <'flex.1'`; then
  1731.     echo shar: \"'flex.1'\" unpacked with wrong size!
  1732.   fi
  1733.   # end of 'flex.1'
  1734. fi
  1735. echo shar: End of archive 4 \(of 10\).
  1736. cp /dev/null ark4isdone
  1737. MISSING=""
  1738. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  1739.     if test ! -f ark${I}isdone ; then
  1740.     MISSING="${MISSING} ${I}"
  1741.     fi
  1742. done
  1743. if test "${MISSING}" = "" ; then
  1744.     echo You have unpacked all 10 archives.
  1745.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1746. else
  1747.     echo You still must unpack the following archives:
  1748.     echo "        " ${MISSING}
  1749. fi
  1750. exit 0
  1751. exit 0 # Just in case...
  1752.